package com.tdp.neo4j;

import java.util.Set;
import java.util.HashSet;

import org.neo4j.graphdb.Direction;
import org.springframework.data.neo4j.annotation.Fetch;
import org.springframework.data.neo4j.annotation.GraphId;
import org.springframework.data.neo4j.annotation.Indexed;
import org.springframework.data.neo4j.annotation.NodeEntity;
import org.springframework.data.neo4j.annotation.RelatedToVia;


@NodeEntity
public class Authors {
	
	@GraphId 
	Long id;
	
	@Indexed
	private int authorID;
	private String authorName;
	private boolean marked = false;
	private int flag;
	@RelatedToVia(type="COOP", direction=Direction.OUTGOING)
	public @Fetch Set<Cooperations> cooperations;
	
	public Authors() {
    }

	public Authors(int id, String name) {
		this.authorID = id;
		this.authorName = name;
		marked = false;
	}
	

//	public Cooperations cooperateTimeWith(Authors author, Double prob){
//		Cooperations cooperate = new Cooperations(this,author,prob);
//		if(cooperations== null) cooperations = new HashSet<Cooperations>();
//		cooperations.add(cooperate);
//		return cooperate;
//	}
	
	public Cooperations cooperateWith(Authors author){
		Cooperations cooperate = new Cooperations(this,author);
		cooperations.add(cooperate);
		return cooperate;
	}
	
	public boolean isMarked() {
		return marked;
	}
	public void setMarked(boolean marked) {
		this.marked = marked;
	}
	public Set<Cooperations> getCooperations() {
		return cooperations;
	}
	public void setCooperations(Set<Cooperations> cooperations) {
		this.cooperations = cooperations;
	}
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public int getAuthorID() {
		return authorID;
	}
	public void setAuthorID(int authorID) {
		this.authorID = authorID;
	}
	public String getAuthorName() {
		return authorName;
	}
	public void setAuthorName(String authorName) {
		this.authorName = authorName;
	}

	public int getFlag() {
		return flag;
	}

	public void setFlag(int flag) {
		this.flag = flag;
	}
	
//	@RelatedTo()
	
}
